Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Prototype for a remote API validation #56

Open
wants to merge 5 commits into
base: staging
Choose a base branch
from
Open

Conversation

aguillon
Copy link
Collaborator

Lots of things need to be improved, but this is a working example of a validation done by a third-party. The exact protocol needs to be written somewhere (I'll probably write documentation next week), but right now we have this:

  • assume we have a regular sponsor registered in the gas station, who deposited credits and registered a contract KT1;
  • examples/main registers to the gas station API at startup with something like
GAS_STATION_URL=http://localhost:8000 uvicorn examples.main:app --port 8005

and associates its own URL and public key with the sponsor (and thus, with the contract KT1)

  • when we send an operation to the gas station, it looks if it needs to get the validation from another API;
  • the operation is sent to the 2nd API, which accepts it up to two times per user;
  • When the 2nd API accepts the operation, it returns a signed receipt to the gas station which checks the signature and tells the gas station what to do: post the operation itself with the deposited credits, return the receipt to the user (if the 2nd API posts the operation itself directly) or return an error.

I used JWT and RSA encryption for the signature of the token. Comments? Suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant